package com.shareach.http.sys.parameter;

import java.util.HashMap;

import org.codehaus.jackson.map.annotate.JsonSerialize;

import com.mongodb.BasicDBObject;
import com.mongodb.DBObject;
import com.shareach.web.basic.IAnswerData;
import com.shareach.web.basic.IAskParameter;

@JsonSerialize(include=(JsonSerialize.Inclusion.NON_NULL))
public class BaseCityParameter implements IAskParameter,IAnswerData {
	public String code;// : "3100",
	public String name;//" : "上海",
	public String tel;//" : "0021",
	public String py;//" : "shanghai",
	public String baidu;//" : "289",
	public String dianping;//" : "1"

	@Override
	public void parseFromMap(HashMap<String, Object> map) {
		if(map.containsKey("code"))this.code = (String)map.get("code");
		if(map.containsKey("name"))this.name = (String)map.get("name");
		if(map.containsKey("tel"))this.tel = (String)map.get("tel");
		if(map.containsKey("py"))this.py = (String)map.get("py");
		if(map.containsKey("baidu"))this.baidu = (String)map.get("baidu");
		if(map.containsKey("dianping"))this.dianping = (String)map.get("dianping");
	}

	@Override
	public DBObject decodeMongo() {
		DBObject result = new BasicDBObject();
		result.put("code", code);
		result.put("name", name);
		result.put("tel", tel);
		result.put("py", py);
		result.put("baidu", baidu);
		result.put("dianping", dianping);
		return result;
	}
}
